package org.wmq.skyserver.controller.admin;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import net.bytebuddy.asm.Advice;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wmq.skycommon.pojo.VO.TurnoverReportVO;
import org.wmq.skycommon.pojo.entity.Result;
import org.wmq.skyserver.service.ReportService;

import java.time.LocalDate;
import java.util.Date;

@RestController
@Api(tags = "数据统计相关接口")
@RequiredArgsConstructor
@RequestMapping("/admin/report")
public class ReportController {
    private final ReportService reportService;

    @GetMapping("/turnoverStatistics")
    @ApiOperation("营业额统计")
    public Result turnoverStatistics(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
                                     @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
        TurnoverReportVO turnoverReportVO = this.reportService.getTurnoverStatistics(begin,end);
        return Result.success(turnoverReportVO);
    }
}
